<template>
	<view>
		<view class="flex align-center justify-between padding-y-16 padding-x-30 bg-fff nav_fixed_top">
			<view @click="goBack()">
				<image src="../../static/img/back.png" style="width: 30rpx;height: 30rpx;margin: 0 auto;"></image>
			</view>
			<view class="radius60 flex1 margin-x-30 padding-x-30 flex align-center" style="background: rgba(102, 102, 102, 0.08);">
				<image src="../../static/img/srh_6.png" style="width: 40rpx;height: 40rpx;"></image>
				<input v-model="q.keywords" @confirm="search()" type="text" class="fs-26 color-333 margin-left-20 ipt flex1" placeholder="请输入">
			</view>
			<view>
				<image  @click="sjump('/pages/msg/index')" src="../../static/img/msg_6.png"  style="width: 46rpx;height: 46rpx;"></image>
			</view>
		</view>
		<!-- 分类 -->
		<view class="padding-20">
			<view class="flex align-center   flex-wrap bg-fff padding-top-24 padding-y-10">
				<view v-for="(item,index) in cate" :key='index' @click="jump('/pages/qiuzhi/two?id='+item.id)" class="w20 text-center margin-bottom-24">
					<image :src="item.pic" class="index_icon"></image>
					<view class="fs-24 color-333">{{item.name}}</view>
				</view>
			</view>
		</view>
		<!-- 分类end -->
		
		<view class="padding-20">
			<view v-for="(item,index) in list" :key='index' @click="jump('/pages/qiuzhi/detail?id='+item.id)" class="bg-fff radius10 padding-x-24 padding-y-30 margin-bottom-30">
				<view class="flex align-center justify-between">
					<text class="fs-30 color-333">{{item.title}}</text>
					<text class="fs-24 color-666">{{item.address}}</text>
				</view>
				<view class="flex align-center justify-between margin-top-30">
					<view>
						<view class="fs-30 color-zhuse">{{item.income}}元 <text class="fs-24 color-999 margin-left-24">·{{item.position}}</text></view>
						<view class="flex align-center margin-top-16">
							<view class="fs-20 color-999 radius10 margin-right-20">{{item.describe}}</view>
							<!-- <view class="fs-20 color-999 radius10 margin-right-20" style="padding: 4rpx 16rpx;border: 1rpx solid #999;">广告</view> -->
							<!-- <view class="fs-20 color-999 radius10 margin-right-20" style="padding: 4rpx 16rpx;border: 1rpx solid #999;">广告</view> -->
							<!-- <view class="fs-20 color-999 radius10 margin-right-20" style="padding: 4rpx 16rpx;border: 1rpx solid #999;">广告</view> -->
						</view>
					</view>
					<view class="public_btn-xs">申请</view>
				</view>
				<view class="flex align-center margin-top-36">
					<image style="width: 70rpx;height: 70rpx;border-radius: 100%;"  :src="item.avatar"></image>
					<view class="margin-left-20">
						<view class="fs-24 color-000">{{item.name}}</view>
						<view class="fs-20 color-999 margin-top-10" style="transform: scale(0.9);">{{item.company_name}}</view>
					</view>
				</view>
			</view>
			
			<view class="nomore" :class="loadStatus" v-if="list.length"></view>
			<empty v-if="list.length < 1"></empty>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				q:{
					category_id:'',
					keywords:'',
					region:'',
					page:1
				},
				hasMore: true,
				loadStatus: '',
				list: [],
				cate:[]
			}
		},
		onLoad(opt) {
			this.q.category_id = opt.id
			this.init()
			this.getList();
		},
		onReachBottom() {
			if(this.hasMore){
				this.q.page += 1;
				this.getList();
			}
		},
		methods:{
			init() {
				this.$api.classify({
					pid: this.q.category_id
				}).then(res => {
					if (res.code == 1) {
						this.cate = res.data;
					}
				})
			},
			getList(){
				this.isLoading = true;
				this.$api.recruit_list(this.q).then(res=>{
					if(res.code == 1){
						this.isLoading = false;
						this.list = [...this.list, ...res.data.data];
						if (res.data.data.length != 0) {
							this.hasMore = true;
							this.loadStatus = '';
						} else {
							this.hasMore = false;
							this.loadStatus = 'over';
						}
					}
				})
			},
			search(){
				this.q.page = 1;
				this.list = [];
				this.getList();
			}
		}
	}
</script>

<style>
	page{
		background: #f7f7f7;
	}
</style>
<style lang="scss" scoped>
	.ipt{height: 70rpx;}
	.index_icon{width: 56rpx;height: 56rpx;}
</style>
